import java.util.Vector;


class P291_39643 {


	public static void main(String[] args) {
		
		Vector solution = new Vector();
		
//		for (int k = 1; k <= 5; k++) {
			for (int l = 1; l <= 5; l++) {
				for (int m = 1; m <= 5; m++) {
					for (int n = 1; n <= 5; n++) {
						for (int o = 1; o <= 5; o++) {
							for (int p = 1; p <= 5; p++) {
								for (int q = 1; q <= 5; q++) {
									for (int r = 1; r <= 5; r++) {
										for (int s = 1; s <= 5; s++) {
											
											int[] array = new int[9]; 
											array[0] = 1;
											array[1] = l;
											array[2] = m;
											array[3] = n;
											array[4] = o;
											array[5] = p;
											array[6] = q;
											array[7] = r;
											array[8] = s;
											
											if (process(array)) {
												solution.addElement(toString(array));
											}
											
										}
									}
								}
							}
						}
					}
				}
			}
//		}
		
		for (int k = 0; k < solution.size(); k++) {
			for (int j = k+1; j < solution.size(); j++ ) {
				if (((String)solution.elementAt(k)).compareTo((String)solution.elementAt(j)) > 0) {
					swap(solution, k, j);
				}
			}
		}
		
		System.out.println("class Main {");
		
		System.out.println("public static void main(String[] args){");
		
		for (int k = 0; k < solution.size(); k++) {
			System.out.println("System.out.println(\"" + solution.elementAt(k) + "\");");
		}
		
		System.out.println("}}");
		
	}
	
	private static void swap(Vector results, int k, int j) {
		String aux = (String) results.elementAt(k);
		results.setElementAt(results.elementAt(j), k);
		results.setElementAt(aux, j);
	}
	
	static boolean process(int[] array) {
		Vector lines = new Vector();
		
		for (int k = 0; k < array.length - 1; k++) {
			String line = array[k] + "" + array[k+1];
			if (lines.contains(line)) return false;
			
			lines.addElement(line);
			lines.addElement(array[k+1] + "" + array[k]);
			
		}
		
		for (int k = 0; k < array.length - 1; k++) {
		
			int next = array[k+1];
			
			if (array[k] == next) return false;
			
			switch(array[k]) {
				case 1:
					if (!(next == 5 || next == 2 || next == 3)) return false;
					break;
				case 2:
					if (!(next == 5 || next == 1 || next == 3)) return false;
					break;
				case 3:
					if (!(next == 5 || next == 2 || next == 1 || next == 4)) return false;
					break;
				case 4:
					if (!(next == 5 || next == 3)) return false;
					break;
				case 5:
					if (!(next == 1 || next == 2 || next == 3 || next == 4)) return false;
					break;
			}
			
		}
		
		return true;
	}
	
	static String toString(int[] array) {
		
		String solution = "";
		
		for (int k = 0; k < array.length; k++) {
			solution = solution + array[k];
		}
		
		return solution;
	}
	
	static String readLn() {
	       String newLine = System.getProperty("line.separator");
	       StringBuffer buffer = new StringBuffer();
	       int car = -1;
	       try {
	           car = System.in.read();
	           while ((car > 0) && (car != newLine.charAt(0))) {
	               buffer.append((char) car);
	               car = System.in.read();
	           }
	           if (car == newLine.charAt(0))
	               System.in.skip(newLine.length() - 1);
	       } catch (java.io.IOException e) {
	           return (null);
	       }
	       if ((car < 0) && (buffer.length() == 0))
	           return (null);
	       return (buffer.toString());
	   }
}
